﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MCSFramework.IFStrategy;

namespace MCSFramework.Model.TEST
{
    [Serializable]
    public class TEST_Client : IModel
    {
        #region 私有变量
        private int _id = 0;
        private string _name = string.Empty;
        private string _telenum = string.Empty;
        private string _mobile = string.Empty;
        private string _fax = string.Empty;
        private string _address = string.Empty;
        private string _postcode = string.Empty;
        private string _prov = string.Empty;
        private string _city = string.Empty;
        private DateTime _inserttime = DateTime.Parse("1990-01-01");
        #endregion

        #region 构造函数
        public TEST_Client()
        { }

        public TEST_Client(int id, string name, string telenum, string mobile, string fax, string address,
            string postcode, string prov, string city, DateTime inserttime)
        {
            _id = id;
            _telenum = telenum;
            _mobile = mobile;
            _fax = fax;
            _address = address;
            _postcode = postcode;
            _prov = prov;
            _city = city;
            _inserttime = inserttime;
        } 
        #endregion

        #region 公共属性
        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public string TeleNum
        {
            get { return _telenum; }
            set { _telenum = value; }
        }

        public string Mobile
        {
            get { return _mobile; }
            set { _mobile = value; }
        }

        public string Fax
        {
            get { return _fax; }
            set { _fax = value; }
        }

        public string Address
        {
            get { return _address; }
            set { _address = value; }
        }

        public string PostCode
        {
            get { return _postcode; }
            set { _postcode = value; }
        }

        public string Prov
        {
            get { return _prov; }
            set { _prov = value; }
        }

        public string City
        {
            get { return _city; }
            set { _city = value; }
        }

        public DateTime Inserttime
        {
            get { return _inserttime; }
            set { _inserttime = value; }
        }
        #endregion

        #region IModel 成员

        public string ModelName
        {
            get { return "TEST_Client"; }
        }

        public string this[string FiledName]
        {
            get
            {
                switch (FiledName)
                {
                    case "ID": return _id.ToString(); 
                    case "Telenum": return _telenum; 
                    case "Mobile": return _mobile; 
                    case "Fax": return _fax; 
                    case "Address": return _address; 
                    case "PostCode": return _postcode; 
                    case "Prov": return _prov; 
                    case "City": return _city; 
                    case "InsertTime": return _inserttime.ToString("yyyy-MM-dd"); 
                    default: return "";
                }
            }
            set
            {
                switch (FiledName)
                {
                    case "ID": int.TryParse(value,out _id); break;
                    case "Telenum": _telenum = value; break;
                    case "Mobile": _mobile = value; break;
                    case "Fax": _fax = value; break;
                    case "Address": _address = value; break;
                    case "PostCode": _postcode = value; break;
                    case "Prov": _prov = value; break;
                    case "City": _city = value; break;
                    case "InsertTime": DateTime.TryParse(value,out _inserttime); break;
                }
            }
        }

        #endregion
    }
}
